﻿@using Radzen
@using Radzen.Blazor

<div class="rz-p-12 rz-text-align-center">
    <RadzenNumeric @bind-Value="Counter" />
    <RadzenButton Text="OK" Click="@OnSubmit" ButtonStyle="Radzen.ButtonStyle.Secondary" />
    <RadzenButton Text="Cancel" Click="@OnCancel" class="rz-ml-2" />
</div>

@code {
    [CascadingParameter]
    private Radzen.Dialog _dialog { get; set; }

    [Inject]
    private Radzen.DialogService _dialogService { get; set; }

    [Parameter]
    public int Counter { get; set; } = 1;

    void OnSubmit()
    {
        _dialogService.Close(Counter); // 明确返回当前Counter值
    }

    void OnCancel()
    {
        _dialogService.Close(); // 返回null
    }
}